<?php
    function startsWith($haystack, $needle) {
        $length = strlen($needle);
        return (substr($haystack, 0, $length) === $needle);
    }

    function abbreviate($content, $length) {
        if (strlen($content) > $length) {
            $pos = strpos($content, " ", $length);
            echo substr($content, 0, $pos) . " ...";
        } else {
            echo $content;
        }
    }
?>